# coding=utf-8
# use lenses.txt file to build a decision tree that help person
# choose a lenses type.

# All feature to choose lenses:
# age: pre, young, presbyopic
# prescript: hyper, myope
# astigmatic: yes, no
# tearRate: reduced, normal
from ml.decision_tree.id3.trees import *
# from ml.decision_tree.treeplot import *


fr = open('lenses.txt')
lenses = [line.strip().split('\t') for line in fr.readlines()]
lenses_labels = ['age', 'prescript', 'astigmatic', 'tearRate']
lenses_labels_tmp = lenses_labels
lenses_tree = create_decision_tree(lenses, lenses_labels_tmp)

# create_plot(lenses_tree)
store_tree(lenses_tree, "lenses_decision_tree")


